<html>
<head>
<script>
var frag1;
var frag2;
var frag3;
var div;
function init() {
	frag1 = document.createElement('span');
	frag1.appendChild( document.createTextNode('One'));
	frag2 = document.createElement('span');
	frag2.appendChild( document.createTextNode('Two'));
	frag3 = document.createElement('span');
	frag3.appendChild( document.createTextNode('Three'));
	div = document.getElementById('d1');
}
function f1() {
	div.removeChild( div.firstChild );
	div.appendChild(frag1);
}
function f2() {
	div.removeChild( div.firstChild );
	div.appendChild(frag2);
}
function f3() {
	div.removeChild( div.firstChild );
	div.appendChild(frag3);
}
</script>
</head>
<body onload='init()' >
<div id='d1'>hello world</div>
<button onclick='f1()'>Test One</button>
<button onclick='f2()'>Test Two</button>
<button onclick='f3()'>Test Three</button>
</body>
</html>
